<template>
	<view>
		<view class="m-card" v-for="(val,key) in list" :key="key">
			<view class="m-card-title">
				<text>{{val.title}}</text>
			</view>
			<view class="m-list">
				<view class="m-item" v-for="(item,index) in val.channels" @click="selectItemFun(item)" :key="index">
					<view class="">
						<text>{{item.title}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad() {
			this.getDataFun()
		},
		methods: {
			selectItemFun(item){
				this.$u.vuex('vuexArea',item.title)
				this.$u.vuex('vuexAreaId',item.id)
				this.to_back()
			},
			getDataFun(){
				this.$http.getJson('hotal_channel',{parentId:0}).then(res=>{
					if(res.code == 1){
						let list = res.data
						let city = this.vuexCity.replace('市','')
						let item = list.find(item=>item.title.indexOf(city) > -1)
						if(!item){
							this.$m.msg('暂无数据',()=>{
								this.to_back()
							})
						}
						this.list = item.channels
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: #f5f5f5;
		padding-top: 20rpx;
	}
.m-card{
	background: #fff;
	padding: 0 25rpx;
	margin-bottom: 20rpx;
	.m-card-title{
		display: flex;
		align-items: center;
		font-size: 28rpx;
		color: #9B958F;
		height: 88rpx;
		border-bottom: 1px solid #E6E2DE;
	}
	.m-list{
		display: flex;
		flex-wrap: wrap;
		.m-item{
			position: relative;
			display: flex;
			justify-content: center;
			align-items: center;
			width: 25%;
			height: 114rpx;
			font-size: 24rpx;
			color: #33302D;
			text-align: center;
			border-bottom: 1px solid #E6E2DE;
			padding: 0 10rpx;
			&::after{
				content: '';
				position: absolute;
				top: 50%;
				right: 0;
				transform: translateY(-50%);
				width: 1px;
				height: 32rpx;
				background: #D3CEC9;
			}
			&:nth-child(4n){
				&::after{
					content: '';
					display: none;
				}
			}
		}
	}
}
</style>
